/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.google.code.jmarias.server.phases;

import com.google.code.jmarias.common.NewPlayer;
import com.google.code.jmarias.common.NewTable;
import com.google.code.jmarias.common.action.ChooseSuitAction;
import com.google.code.jmarias.common.action.SayBadAction;
import com.google.code.jmarias.common.action.SignedAction;
import com.google.code.jmarias.server.tcp.MariasGame;

/**
 *
 * @author josef
 */
public class ForhontDecisionPhase extends NewAbstractPhase {

    public ForhontDecisionPhase(NewPlayer playingNow) {
        super(playingNow);

        addListener(new ActionListener(ChooseSuitAction.class) {

            @Override
            protected NewAbstractPhase processAction(SignedAction action, NewTable table) {

                broadcast(action);

                return new DealerDecisionPhase(table.getPlayer(MariasGame.right));
            }
        });

        addListener(new ActionListener(SayBadAction.class) {

            @Override
            protected NewAbstractPhase processAction(SignedAction action, NewTable table) {

                throw new RuntimeException("Zpracovani akce SayBadAction dosud neimplementovano");
            }
        });
    }

    @Override
    public String toString() {
        return "Prvni hrac obrany rika barvu.";
    }

//    public ForhontDecisionPhase() {
//    }
//
//    @Override
//    public AbstractPhase processSayBadAction(SayBadAction action) {
//        table.getClients().get(1).sendMessage(new SendTalonAction(table.getTalon()));
//        Player[] players = table.getPlayers();
//        Card[] talon = new Card[2];
//        for (int i = 0; i < table.getTalon().size(); i++) {
//            talon[i] = table.getTalon().get(i);
//        }
//        players[1].addCardsToHand(talon);
//        return new BadTalonDroppingPhase(1);
//    }
//
//    @Override
//    public AbstractPhase processChooseSuitAction(ChooseSuitAction action) {
//        table.getClients().get(2).sendMessage(new AskForChoiceAction(0));
//        return new DealerDecisionPhase();
//    }


}
